package com.hbun.cxcy.controller;


import com.hbun.cxcy.common.utils.R;
import com.hbun.cxcy.service.ApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
@CrossOrigin
@RestController
@RequestMapping("/cxcy/echarts")
public class EchartsController {
    @Autowired
    ApplyService applyService;
    @GetMapping("/professionalToBar")
    public R professionalGroupBy(){
        Map<String, Object> res = applyService.selectGroupByProfessional();
        return R.ok().put("data",res);
    }
    @GetMapping("/professionalToPie")
    public R professionalGroupByToPie(){
        Map<String, Object> res = applyService.selectGroupByProfessionalToPie();
        return R.ok().put("data",res);
    }


    @GetMapping("/everyDayPeopleToLine")
    public R everyDayPeople(){
        Map<String, Object>res = applyService.everyDayPeople();
        return R.ok().put("data",res);
    }

    @GetMapping("/deptToBar")
    public R deptGroupBy(){
        Map<String,Object> res = applyService.deptGroupBy();
        return R.ok().put("data",res);
    }

    @GetMapping("/sexToBar")
    public R sex(){
        Map<String,Object> res = applyService.sexGroupBy();
        return R.ok().put("data",res);
    }
}
